package com.equalsandhashcode1;

public class Customer {
private int cid;
private String cname;
private long phone;
Customer(int cid,String cname,long phone){
	this.cid=cid;
	this.cname=cname;
	this.phone=phone;
}
public int getCid() {
	return cid;
}
public void setCid(int cid) {
	this.cid = cid;
}
public String getCname() {
	return cname;
}
public void setCname(String cname) {
	this.cname = cname;
}
public long getPhone() {
	return phone;
}
public void setPhone(long phone) {
	this.phone = phone;
}
public String toString(){
	return cid+"\t"+cname+"\t"+phone;
}
public int hashCode(){
	String id=Integer.toString(cid);
	String ph=Long.toString(phone);
	int hash=id.hashCode()+ph.hashCode()+cname.hashCode();
	
	return hash;
}
public boolean equals(Object obj){
	Customer cust=(Customer)obj;
	return this.cid==cust.cid && this.cname==cust.cname && this.phone==cust.phone;
}
}
